// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the LPRWRAPPER_EXPORTS
// symbol defined on the command line. This symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// LPRWRAPPER_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#pragma once

#ifdef LPRWRAPPER_EXPORTS
#define LPRWRAPPER_API __declspec(dllexport)
#else
#define LPRWRAPPER_API __declspec(dllimport)
#endif

namespace Kise
{
	namespace Lpr
	{
		enum ImageFormat 
		{ 
			BGR = 0 ,
			RGB, 
			YUV422,
			YUV420COMPASS 
		};

		struct Rect
		{
			int X, Y, Width, Height;
		};

		struct	RecognizeResult
		{
			bool Succeed;
			int Confidence;
			char PlateNumber[16];
			Rect PlateRectangle;
			int PlateType;
			int PlateColor;
			unsigned char CarColor;
		};

class LPRWRAPPER_API CLprRecognizer
{
public:
	// TODO: Add your methods for this class here.
	CLprRecognizer();
	~CLprRecognizer();

	void SetImageFormat(ImageFormat imageFormat, bool verticalFlipped, bool hasPadding);
	RecognizeResult RecogImage(unsigned char bmpData[], int width, int height);
	RecognizeResult RecogImage(unsigned char bmpData[], int width, int height, Rect searchRegion);
	void SetCharacterPriority(const char* pCharacters);

private:
	void CheckResult( int n );

private:
	void* m_mem1;
	int m_mem1Size;
	void* m_mem2;
	int m_mem2Size;
	void* m_config;

};
}
}


extern "C"
{

LPRWRAPPER_API void WINAPI  Init();
LPRWRAPPER_API void WINAPI  UnInit();
LPRWRAPPER_API void WINAPI SetImageFormat(Kise::Lpr::ImageFormat imageFormat, bool verticalFlipped, bool hasPadding);
LPRWRAPPER_API Kise::Lpr::RecognizeResult WINAPI RecogImage(unsigned char bmpData[], int width, int height, Kise::Lpr::Rect searchRegion);
LPRWRAPPER_API void WINAPI SetCharacterPriority(const char* pCharacters);

}